<%--
  Created by IntelliJ IDEA.
  User: 骆鹏
  Date: 2017/7/26
  Time: 10:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <title>考核项目设定</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">

    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link type="text/css" rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/css/base/base.css?20201106.1">

    <script src="/js/common/language.js"></script>

    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/pagination/js/jquery.pagination.min.js"></script>

    <%--<script src="/js/document/makeADraft.js"></script>--%>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <style>

        table tr {
            border-width: 1px;
            border-style: solid;
            border-color: rgb(204, 204, 204);
            border-image: initial;
        }
        table tr th {
            font-size: 13pt;
            color: rgb(47, 92, 143);
            text-align: center;
            padding: 6px;
        }

        table  td {
            font-size: 11pt;
            padding: 6px;
            height: 30px;
            line-height: 30px;
            text-align: center;
        }
        table tr:nth-child(2n) {
            background-color: rgb(255, 255, 255);
        }
        table tr:nth-child(2n+1) {
            background-color:#F6F7F9 ;
        }
        .newLeave {
            border-radius: 3px;
            margin-right: 3%;
            float: right;
            width: 70px;
            height: 28px;
            color: #fff;
            font-size: 14px;
            line-height: 28px;
            margin-right: 3%;
            margin-top: 14px;
            cursor: pointer;
            background: #2b7fe0
        }
        .clearfix {
            margin: 5px auto;
            width: 100%;
        }
        .clearfix a{
            color: #007cfd;
        }
        textarea.BigStatic {
            font-size: 10pt;
            padding: 1px 5px;
            border: 1px solid #C0BBB4;
            background: #E0E0E0;
            margin-left: 32px;
        }
        .index-desc{
            height: 95px;
            float: left;
            line-height: 95px;
            margin-right: 9px;
        }
        .lab-set{
            height: 50px;
            float: left;
            line-height: 47px;

        }
        #portalName{
            height: 30px;
            margin-right: 16px;
        }
        .li-set p{
            margin: 5px 0 0 103px;
        }
        .M-box3 .active {
            margin: 0px 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            background: #2b7fe0;
            font-size: 12px;
            border: 1px solid #2b7fe0;
            color: #fff;
            text-align: center;
            display: inline-block;
        }
        .M-box3 {
            margin-top: 30px;
            position: fixed;
            bottom: 10px;
            right: 60px;
            text-align: center;
        }
        .M-box3 a {
            margin: 0 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            font-size: 12px;
            display: inline-block;
            text-align: center;
            background: #fff;
            border: 1px solid #ebebeb;
            color: #333;
            text-decoration: none;
        }
        .jump-ipt {
            width: 38px;
            height: 38px;
            line-height: 38px;
            text-align: center;
            padding: 0;
        }
    </style>
</head>
<body>
<div class="headTop" id="maintop">
    <div class="headImg">
        <img src="/img/kaohesheding.png" alt="">
    </div>
    <div class="divTitle">
        考核指标集管理
    </div>
</div>
<div id="" class="layui-layer-content" style="height: 399px;margin-top: 60px"><form id="saveRule" class="layui-form"><div class="inputlayout" style="width: 600px;margin: 0 auto"><ul><li class="clearfix"><p style="text-align: center;background: #f0f0f0;font-weight: 700;height:36px;line-height: 36px;font-size: 16px">考核指标集</p></li><li class="clearfix"><label><span style="color:#e4393c">*</span> 考核指标集名称：</label><input id="portalName" type="text" name="portalName" value="" maxlength="25">(最多输入25个字)</li><li class="clearfix li-desc"><label class="index-desc">考核指标集描述：</label><textarea class="text-desc" name="portalMark" id="portalMark" cols="48" rows="5"></textarea></li><li class="clearfix"><label>设定考核依据模块：</label><input id="sortNo" type="checkbox" name="sortNo" value=""><label class="theLog">个人工作日志</label><input id="sortNo" type="checkbox" name="sortNo" value=""><label class="theLog">个人日程安排</label></li><li class="clearfix li-set"><label class="lab-set"> 按部门设置：</label><textarea cols="40" name="USER_NAME" rows="2" class="BigStatic" id="deptNames" wrap="yes" readonly=""></textarea>
    <a href="javascript:;" class="orgAdd  addDept release3 ">添加</a>
    <a href="javascript:;" class="orgClear release3 clearDept">清空</a>
</li><li class="clearfix li-set"><label class="lab-set"> 按人员设置：</label><textarea cols="40" name="USER_NAME" rows="2" class="BigStatic" id="query_toId" wrap="yes" readonly=""></textarea>
    <a href="javascript:;" class="orgAdd release3 " id="personnel">添加</a>
    <a href="javascript:;" class="orgClear release4 empty">清空</a>
</li><li class="clearfix li-set"><label class="lab-set"> 按角色设置：</label><textarea cols="40" name="USER_NAME" rows="2" class="BigStatic" id="userPrivInput" wrap="yes" readonly=""></textarea>
    <a href="javascript:;" class="orgAdd userPrivAdd">添加</a>
    <a href="javascript:;" class="orgClear userPrivClear">清空</a>
    <p> <span style="color: #e4393c">*</span>考核指标集使用范围取部门、人员和角色的并集</p></li></ul></div></form>
</div>
<div class="layui-layer-btn layui-layer-btn-" style="width:600px;margin: 0 auto"><a class="layui-layer-btn0" id="baocun">保存</a><a class="layui-layer-btn1" id="quxiao">取消</a></div>

<script>
   /* if ($('#portalName').val() == '') {
        layer.msg('请填写考核指标集名称', {icon: 6});
        return false;
    }
    if ($('#portalMark').val() == '') {
        layer.msg('请填写考核指标集描述', {icon: 6});
        return false;
    }*/
   function getRequest() {
       var url = window.location.search; //获取url中"?"符后的字串
       var theRequest = new Object();
       if (url.indexOf("?") != -1) {
           var str = url.substr(1);
           strs = str.split("&");
           for(var i = 0; i < strs.length; i ++) {

               theRequest[strs[i].split("=")[0]]=decodeURI(strs[i].split("=")[1]);

           }
       }
       return theRequest;
   }
   function inputcheck(name,value) {
       $('#'+name+'').val(value)
   }
   var groupId= getRequest().groupId;

   $.ajax({
        type: 'post',
        url: '/ScoreGroupLeader/selScoreGroup',
        dataType: 'json',
        data: {
            groupId:groupId
        },
        success: function (res) {
            var objs=  res.obj[0]
            inputcheck('portalName',objs.groupName)
            inputcheck('portalMark',objs.groupDesc)
            inputcheck('deptNames',objs.toId)
            inputcheck('query_toId',objs.privId)
            inputcheck('userPrivInput',objs.userId)
        }
    })
        // 获取部门信息控件
        // 添加部门信息
    $(".addDept").on("click", function () {
        dept_id = "deptNames";
        $.popWindow("/common/selectDept");
    });
        // 清空部门信息
    $('.clearDept').click(function () {
        $('#deptNames').attr("deptid", "");
        $('#deptNames').attr("deptno", "");
        $('#deptNames').attr("deptname", "");
        $('#deptNames').val("");
    });


        /* 选人控件 */
    $("#personnel").on("click",function(){
        user_id = "query_toId";
        $.popWindow("/common/selectUser");
    });
    $('.orgClear').click(function () {
        $("#query_toId").val("");
        $("#query_toId").attr('username','');
        $("#query_toId").attr('dataid','');
        $("#query_toId").attr('user_id','');
        $("#query_toId").attr('userprivname','');
    });

        // 获取角色信息控件
    $(".userPrivAdd").on("click",function(){
        priv_id="userPrivInput";
        $.popWindow("/common/selectPriv");
    });
    // 清空角色信息
    $('.userPrivClear').click(function () {
        $('#userPrivInput').attr("privid","");
        $('#userPrivInput').attr("userpriv","");
        $('#userPrivInput').val("");
    });
    $('#baocun').click(function(){
       var groupName = $('#portalName').val()
       var groupDesc = $('#portalMark').val()
       var deptNames = $('#deptNames').val()
       var query_toId = $('#query_toId').val()
       var userPrivInput = $('#userPrivInput').val()

       $.ajax({
           type: 'post',
           url: '/ScoreGroupLeader/modifyScoreGroup',
           dataType: 'json',
           data: {
               groupId:groupId,
               groupName: groupName,
               groupDesc: groupDesc,
               toId:deptNames,
               privId:query_toId,
               userId:userPrivInput
           },
           success: function () {
               layer.msg("修改成功", {
                   icon: 1,
                   time: 1500 //2秒关闭（如果不配置，默认是3秒）
               }, function () {
                   window.location.href='/ScoreGroupLeader/scoreGroup';
               });


           }
       });
   })
   $('#quxiao').click(function(){
       window.location.href='/ScoreGroupLeader/scoreGroup';
   })
</script>
</body>
</html>
